package com.example.onlineeducation.mapper

import com.example.onlineeducation.data.entity.FileEntitiy
import com.example.onlineeducation.data.entity.OfflineExamDetailEntity
import com.example.onlineeducation.data.json.OfflineExamRecordListJson
import com.yc.jetpacklib.extension.ycToNoEmpty
import com.yc.jetpacklib.mapper.IMapper

/*
* 线下考试详情
* */
class OfflineExamDetailMapper : IMapper<OfflineExamRecordListJson?, OfflineExamDetailEntity?> {
    override fun map(input: OfflineExamRecordListJson?): OfflineExamDetailEntity? {
        return if (input == null) {
            null
        } else {
            OfflineExamDetailEntity(
                input.id,//人员考试记录的id
                input.personName.ycToNoEmpty(),//姓名
                input.personTypeName.ycToNoEmpty(),//工种类型
                input.point,//考试分数
                input.costTime,//答题时长
                input.testDate,//考试日期
                input.groupName.ycToNoEmpty(),//班组名
                input.webPathList?.map { //卷面图
                    FileEntitiy(it?.webPath)
                }
            )
        }
    }
}
